package cn.ht.jywrwater.module.ht.dal.mysql.waterstation;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.waterstation.WaterStationDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.waterstation.vo.*;

/**
 * 供水站 Mapper
 *
 * @author hzx
 */
@Mapper
public interface WaterStationMapper extends BaseMapperX<WaterStationDO> {

    default PageResult<WaterStationDO> selectPage(WaterStationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WaterStationDO>()
                .eqIfPresent(WaterStationDO::getStationCode, reqVO.getStationCode())
                .likeIfPresent(WaterStationDO::getStationName, reqVO.getStationName())
                .betweenIfPresent(WaterStationDO::getStationTime, reqVO.getStationTime())
                .orderByDesc(WaterStationDO::getId));
    }

    default List<WaterStationDO> selectList(WaterStationExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WaterStationDO>()
                .eqIfPresent(WaterStationDO::getStationCode, reqVO.getStationCode())
                .likeIfPresent(WaterStationDO::getStationName, reqVO.getStationName())
                .betweenIfPresent(WaterStationDO::getStationTime, reqVO.getStationTime())
                .orderByDesc(WaterStationDO::getId));
    }

}
